import Vue from 'vue'
import Vuex from 'vuex'
import user from './modules/user'
import permission from './modules/permission'
import basicData from './modules/basicData'

Vue.use(Vuex)

export default new Vuex.Store({
    modules: {
        user,
        permission,
        basicData
    },
    getters: {
        permission_routes: state => state.permission.routes, // 完整路由
        roles: state => state.user.roles,
        hasRoles: state => state.user.roles && state.user.roles.length > 0,
        getToken: state => state.user.token
    }
})